/*
 * Tower.h
 *
 *  Created on: Oct 16, 2010
 *      Author: Jacob
 */
#pragma once
#include "stdafx.h"
#include "Stack.h"
#include "Peg.h"
#include <string>
#include <sstream>
using std::string;
using std::ostringstream;
using std::stringstream;

class Tower
{
public:
	static Tower* newTowerWithName(string name);
	static Tower* newTowerWithStartingPegsAndName(int numberOfPegs, string name);
	bool addPeg(Peg*  pegToBeAdded);
	Peg* removeTopPeg();
	void clearTower();
	bool hasPegs();
	void setName(string name);
	string toString();
	virtual ~Tower();
private:
	string name;
	Stack<Peg*>* pegs;
	void generatePegs(int numberOfPegs);
	bool pegCanBeTaken(Peg* potentialPeg);
	bool isEmpty();
	Tower(string name);
	Tower(int numberOfPegs, string name);
};

